package com.zyt.springboot.paixu;

import java.util.Arrays;

/*
 * 腾哥专用代码防伪标志！！！
 * @params: 选择排序算法
 */
public class XuanZePaiXu {
    public static void main(String[] args) {
        /*
        选择排序：用一个元素依次和后边元素相比较
        */
        int[] ints = new int[]{9,8,3,4,5};
//        System.out.println(Arrays.toString(Arrays.stream(ints).sorted().toArray()));
        for(int i = 0;i< ints.length;i++){
            for (int j = i+1;j< ints.length;j++){
                int temp = 0;
                if(ints[i]>ints[j]){
                    temp = ints[j];
                    ints[j] = ints[i];
                    ints[i] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(ints));
    }
}
